<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\Member\models\MemberSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '同业客户管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="member-index">

     <h2 class="page-header">
        <?= Html::encode($this->title) ?> 
        <p class="pull-right">
           <?= Html::a('员工管理', ['index'], ['class' => 'btn btn-danger']) ?>
        </p>
    </h2>

<?php Pjax::begin(); ?> 
     <p><?php  echo $this->render('_osearch', ['model' => $searchModel]); ?></p> 
     <?= GridView::widget([
        'dataProvider' => $dataProvider,
        // 'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

           // 'id',
            'name',
            'phone',
            'mail',
            'company',
            //'password',
            // 'address',
            //'position',
            // [
            //     'attribute' => 'position',
            //     'filter' =>  Yii::$app->params['position'],
            //     'value' => function ($model) {
            //             return Yii::$app->params['position'][$model->position];
            //         },
            // ],
            //'group',
            // [
            //     'attribute' => 'group',
            //     'filter' =>  Yii::$app->params['work_group'],
            //     'value' => function ($model) {
            //             return Yii::$app->params['work_group'][$model->group];
            //         },
            // ],
            // 'dist_id',
            // 'type',
            [
                'attribute' => 'type',
                'filter' =>  Yii::$app->params['memberType'],
                'value' => function ($model) {
                        return Yii::$app->params['memberType'][$model->type];
                    },
            ],
            // 'desc',
            // 'status',
            // 'created_at',
            // 'updated_at',
            // 'gender',
            [
                'attribute' => 'status',
                'filter' =>  Yii::$app->params['member_status'],
                'value' => function ($model) {
                        return Yii::$app->params['member_status'][$model->status];
                    },
            ],
            [
                'label'=>'操作',
                'format'=>'raw',
                'value' => function($model){
                    $url = sprintf("/member/member/check?id=%d", $model->id);
                    $url2 = sprintf("/member/member/mem-update?id=%d",$model->id);
                    if($model->status == 3){
                        return Html::a('<i class="glyphicon glyphicon-check"></i>', $url, ['title' => '审核','data-confirm' => '您确定审核通过吗？','data-method' => 'post','data-pjax'=>0]); 
                    }else{
                        return Html::a('<i class="glyphicon glyphicon-pencil"></i>', $url2, ['title' => '更新','data-pjax'=>0]); 
                    } 

                   
                }
            ]        
        ],
    ]); ?>
<?php Pjax::end(); ?></div>


